package com.oba.king.sysmanager.log;

import java.util.Date;
import java.util.List;

import com.oba.base.dao.DBDataModel;
import com.oba.base.interfaces.PageCallBack;
import com.oba.base.service.BaseBean;

public class LogBean extends BaseBean<Log, LogService> {
	
	DBDataModel logData = DBDataModel.create(new PageCallBack() {
		
		public void afterLoadPage(List curPage) {
			for(Object obj:curPage) {
				Log log = (Log) obj;
				log.setTableInfo(TableService.getInit().getTableInfo(log.getCode()));
			}
		}
	});
	
	// search condition
	private Integer type;
	private String fullName;
	private Date startTime;
	private Date endTime;

	@Override
	public String doFind() {
		logData.find(getService().getDao().buildByCondition(type, TableService.getInit().getCodeByName(fullName), startTime, endTime, null));
		return null;
	}
	
	public void doFindMine() {
		logData.find(getService().getDao().buildByCondition(type, TableService.getInit().getCodeByName(fullName), startTime, endTime, getSysUser()));
	}

	@Override
	public void init() {
		doFind();
	}
	
	public DBDataModel getLogData() {
		return logData;
	}

	public void setLogData(DBDataModel logData) {
		this.logData = logData;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public void clear() {
		type = 0;
		fullName = "";
		startTime = null;
		endTime = null;
	}

}
